﻿@{
    ViewBag.Title = "Linux sh应用程序查找、启动、停止命令";
    ViewBag.keywords = "Linux sh应用程序查找、启动、停止命令";
    ViewBag.description = "Linux sh应用程序查找、启动、停止命令，用于快速的启动应用程序和重启应用程序";
    Layout = "_oayout";
    var host = Appsettings.app("BaseFile:HostUrl");
}
@section Styles{
}
<div class="layui-row">
    <div class="layui-elem-quote">
        <p>
            BaseLinux sh应用程序查找、启动、停止命令：
        </p>
        <p>将命令复制到后缀为sh的文件保存即可</p>
        <p>若遇到文件无法执行的情况，请检查文件的权限</p>
    </div>
</div>
<div class="layui-row layui-form layui-form-pane">
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">应用程序名：</label>
        <div class="layui-input-block">
            <textarea placeholder="请输入应用程序名" id="content" name="content" rows="4" lay-verify="required" autocomplete="off" class="layui-textarea">RuoVea.Entry.dll</textarea>
        </div>
    </div>
    <div class="layui-form-item ">
        <a class="layui-btn creter">生成</a>
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">输出停止命令：</label>
        <div class="layui-input-block">
            <textarea placeholder="输出停止命令" id="outstop" name="outstop" rows="8" autocomplete="off" class="layui-textarea"></textarea>
        </div>
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">输出启动命令：</label>
        <div class="layui-input-block">
            <textarea placeholder="输出启动命令" id="outstart" name="outstart" rows="8" autocomplete="off" class="layui-textarea"></textarea>
        </div>
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">输出重启命令：</label>
        <div class="layui-input-block">
            <textarea placeholder="输出重启命令" id="outreset" name="outreset" rows="8" autocomplete="off" class="layui-textarea"></textarea>
        </div>
    </div>
</div>


@section Scripts{
<script type="text/javascript">
       layui.config({ base: '@host/js/' }).use('common',function(){
           $=layui.jquery;
          var inptxt= $("#content").val();

            $(".creter").bind("click", function () {
                    if (inptxt === undefined || inptxt === '' || inptxt === null) { layer.msg("内容不能为空.", { icon: 2 }); return; }

                var stopstr='echo "TdyRis.Entry 进程信息" \n'+
                'ps -ef | grep TdyRis.Entry.dll| grep -v grep \n'+
                'echo "停止服务" \n'+
                'ps -ef | grep TdyRis.Entry.dll | grep -v grep | awk \'{print $2}\' | xargs kill -9 \n'+ 
                'echo "停止服务完成" \n';

                var startstr='echo "启动服务" \n'+
                'nohup dotnet TdyRis.Entry \n'+
                'echo "启动服务完成" \n';

                $("#outstop").val(stopstr);
                $("#outstart").val(startstr);
                $("#outreset").val(stopstr+startstr);
                 
            });
       });

</script>
}